<?php
	
	// Session
	session_start();
	
	
	// Integrimi i skedave sistemore
    include('../include/functions.inc.php');
	include('../include/template.class.php');
	
	// Project
	$PROJECT = setProject();
	
	
	// Ndyshoret primare
	define('TPL','../include/styles/'.$PROJECT['style'].'/members/logout.html');
	define('UID',$_SESSION['user_id']);
	define('FILENAME',basename($_SERVER["PHP_SELF"]));
	
	
	// Connection
	dbOpen("comunity");
	
	
	// Inicializimi i shablonave
	$tmp = new Template(TPL,$PROJECT['lang']);
	
	
	// LABELS
	$tmp->setLabels();
	
	
	if (isset($_GET['splash'])) 
		splash($_GET['splash'], "../index.php");
		
	
	// MENUES
	$tmp->setContent("CATEGORY",$tmp->menu("category","../members"));
	$tmp->setContent("FOOTMENU",$tmp->menu("foot"));
	
	
	// ACCORDIONS
	$tmp->setContent("LOGOUT",$tmp->xmlContent("logout"));

	
	
	// Aplikimi i formes
	if(isset($_GET['set'])) {
		
		// Session
		session_destroy();
		unset($_SESSION['user_id']);
		
		// Nese sessioni eshte fshire
		if (!isset($_SESSION['user_id'])) {
			
			$query = mysql_query("UPDATE users SET logout = '0' WHERE id = '".UID."'");
			
			// Rilexo faqen me porosin per sukses
			header('Location: logout.php?splash=logout'); 
			exit;
		}
	}

	
	// Dhe cdo gje ka nje fund, trego faqen						  
	echo $tmp->vorlage;
	
?>